<?php

namespace App\Controllers\Admin;

use App\Controllers\BaseController;
use CodeIgniter\Config\Database;
use CodeIgniter\HTTP\RequestInterface;

class MyTest extends BaseController
{
    public function index(): string
    {
        return view('welcome_message');
    }
	function set_state($id=1,$state=0)
	{
		$result = array();
		$result['id'] = $id;
		$result['state'] = $state;
		echo json_encode($result);
	}
	function query_search()
	{
		print_r($this->request->getVar());
	}
	function json_add()
	{
		$request = service('request');
		$json = $request->getJSON(true);
		
		print_r($json);
	}
	function db_test()
	{
		$db = \Config\Database::connect();
		$builder = $db->table('l7_defense_ifname');
		$query  = $builder->get();
		print_r($query->getResultArray());
	}
}
